package com.kaifamiao.N0716;

import java.util.Random;
import java.util.Scanner;

public class Node7 {
    public static void main(String[] args) {

        boolean result = true; // 循环变量
        Random rand = new Random();
        Scanner sc = new Scanner(System.in);

        int winCount = 0;

        while (winCount < 3){
            // 生产随机数
            int a = rand.nextInt(3);

            System.out.println("请输入： 0.石头 1.剪刀 2.布");
            // 获取输入
            int b = sc.nextInt();

            if(b >= 3){
                System.out.println("输入错误");
                continue;
            }

                System.out.println("机器出: " + a);

            if (a == b){
                System.out.println("平局");
            }
            else if((b == a - 1) || (a == 0 && b == 2)){
                System.out.println("你赢了.");
                result = false;
                winCount ++;
            }
            else {
                System.out.println("你输了.");
            }
        }
    }
}
